package event

import "proto/dto"

type Type int

const (
	// Event_Bind_Bike 绑定车辆事件
	Event_Bind_Bike Type = iota + 1
	// Event_UnBind_Bike 解绑车辆事件
	Event_UnBind_Bike
	// Event_User_Reg 用户注册事件
	Event_User_Reg
	// Event_Power_On 车辆上电通知
	Event_Power_On
	// Event_Power_Off 车辆下电通知
	Event_Power_Off
	// Event_Power_On_Cmd 车辆上电命令
	Event_Power_On_Cmd
	// Event_Power_Off_Cmd 车辆下电命令
	Event_Power_Off_Cmd
	// Event_Bike_Cmd 车辆绑定命令
	Event_Bike_Cmd
	// Event_Power_On_Finish 车辆上电完成
	Event_Power_On_Finish
	// Event_Power_Off_Finish 车辆下电完成
	Event_Power_Off_Finish
	// Event_Clear_Data  车辆变动，清除数据
	Event_Clear_Data
	// Event_Command_Report  车辆命令上报
	Event_Command_Report
	// Event_Control_Report  车辆控制上报
	Event_Control_Report
	Event_Bike_Online
	Event_Bike_Offline
	Event_Mq_SyncDevice
)

// BindBike  Event_Bind_Bike
type BindBike struct {
	BikeId int64 `json:"bike_id"`
	UserId int64 `json:"user_id"`
}

// UnBindBike  Event_UnBind_Bike
type UnBindBike struct {
	BikeId int64 `json:"bike_id"`
	UserId int64 `json:"user_id"`
}

// UserReg  Event_User_Reg
type UserReg struct {
	UserId int64 `json:"user_id"`
}

// BikePowerOn 上电
type BikePowerOn struct {
	EbikeId int64 `json:"ebike_id"`
}

// BikePowerOff 下电
type BikePowerOff struct {
	EbikeId int64 `json:"ebike_id"`
}

// BikePowerOnCmd 一键启动命令
type BikePowerOnCmd struct {
	UserId int64 `json:"user_id"`
	BikeId int64 `json:"bike_id"`
}

// BikePowerOffCmd 一键关闭命令
type BikePowerOffCmd struct {
	UserId int64 `json:"user_id"`
	BikeId int64 `json:"bike_id"`
}

// BikeCmd 车辆命令
type BikeCmd struct {
	EbikeId int64       `json:"ebike_id"`
	CmdType string      `json:"cmd_type"`
	Body    interface{} `json:"body"`
}

// ClearBikeData  Event_Clear_Data
type ClearBikeData struct {
	BikeId int64 `json:"bike_id"`
	UserId int64 `json:"user_id"`
}

// CommandReport  Event_Command_Report
type CommandReport struct {
	EbikeId int64         `json:"ebike_id"`
	Cmd     dto.EventType `json:"cmd"`
}

// ControlReport  Event_Control_Report
type ControlReport struct {
	SnCode string `json:"sn_code"`
	Data   *dto.ControllerReply
}

// BikeOnline  Event_Bike_Online
type BikeOnline struct {
	BikeId int64 `json:"bike_id"`
}

// BikeOffline  Event_Bike_Offline
type BikeOffline struct {
	BikeId int64 `json:"bike_id"`
}

// MqSyncDevice  Event_Mq_SyncDevice
type MqSyncDevice struct {
	Sn         string                 `json:"sn"`
	UpdateType dto.EnUpdateType       `json:"update_type"`
	MapValue   map[string]interface{} `json:"map_value"`
}

type Data struct {
	Type Type
	Data interface{}
}
